import '../network/ac_http_utils.dart';

class AcUrls {
  // 埋点host
  static const String logHost = 'http://log.heeru.xyz';

  // 埋点
  static const String log = '/log/live-chat';

  // 隐私协议
  static const String privacy = 'http://h5.heeru.xyz/privacyPolicy.html';

  // oss
  static const String oss = '/user/oss/policy';

  // oss search
  static const String ossSearch = '/shortLink/media/search';

  // 用户协议
  static const String userAgreement = 'http://h5.heeru.xyz/termConditions.html';

  // 获取配置
  static const String config = 'config/getAppConfig';

  // 获取融云token
  static const String getToken = 'user/rongcloud/token';

  // 策略接口
  static const String getStrategy = 'config/getStrategy';

  // 登录
  static const String login = 'security/oauth';

  // 退出登录
  static const String logout = 'security/logout';

  // 删除账号
  static const String deleteAccount = 'user/deleteAccount';

  // 校验token
  static const String isValidToken = 'security/isValidToken';

  // 获取用户资料列表
  static const String getUserInfoList = 'broadcaster/wall/search';

  // 获取用户信息
  static const String getUserInfo = 'user/getUserInfo';

  // 关注
  static const String follow = 'user/addFriend';

  // 取消关注
  static const String unFollow = 'user/unfriend';

  // 举报\拉黑接口
  static const String report = 'report/complain/insertRecord';

  // 解除拉黑接口
  static const String unBlock = 'report/complain/removeBlock';

  // 拉黑列表
  static const String blockList = 'report/complain/blockList';

  // 取消拉黑
  static const String removeBlock = 'report/complain/removeBlock';

  // 关注列表
  static const String followList = 'user/getFriendsListPage';

  // 更新头像
  static const String updateAvatar = 'user/updateAvatar';

  // 保存用户信息
  static const String saveUserInfo = 'user/saveUserInfo';

  // 充值商品列表
  static const String goodsList = 'coin/goods/search';

  // 创建订单
  static const String createOrder = 'coin/recharge/create';

  // 验单
  static const String checkOrder = 'coin/recharge/payment/ipa';

  // 消费
  static const String consume = 'coin/reviewModeConsume';
}

extension UrlExtension on String {
  Future get({
    Map<String, dynamic>? queryParameters,
    bool showLoading = true,
    bool showErrorMessage = true,
  }) {
    return AcHttpUtils.get(
      path: this,
      queryParameters: queryParameters,
      showLoading: showLoading,
      showErrorMessage: showErrorMessage,
    );
  }

  Future<dynamic> post({
    dynamic data,
    bool encrypt = true, //加密
    bool showLoading = true,
    bool showErrorMessage = true,
    Map<String, dynamic>? queryParameters,
  }) {
    return AcHttpUtils.post(
      path: this,
      data: data,
      queryParameters: queryParameters,
      showLoading: showLoading,
      showErrorMessage: showErrorMessage,
    );
  }
}
